package com.car.dal.dao.notice;

import java.util.List;

import com.car.bean.GridObj;
import com.car.bean.OrderObj;
import com.car.bean.PageObj;
import com.car.dal.dao.ibatis.IbatisCommonDao;
import com.car.dal.object.TgMoney;
import com.car.dal.object.TgNotice;
import com.car.util.Page;

public class TgNoticeDaoImpl extends IbatisCommonDao<TgNotice, Long> implements TgNoticeDao {

	public GridObj GetList(TgNotice notice, PageObj pageObj) {
		OrderObj order = new OrderObj();
		order.setDir("desc");
		order.setSort("create_time");
		// TODO Auto-generated method stub
		return super.findByPage(notice, pageObj, order);
	}
	
	public Integer getNoticeCountByType(TgNotice notice) {
		return this.queryForInteger("getNoticeCountByType", notice);
	}
	
	public List<TgNotice> getNoticeByType(TgNotice notice,Page page) {
		notice.setFirstrownum(page.getFirstrownum());
		notice.setPagesize(page.getPagesize());
		List<TgNotice> list=this.queryForEntityList(TgNotice.class,"getNoticeByType", notice);
		return list;
	}
	
	//最后一个
	public TgNotice getNoticeLast(TgNotice notice) {
		List<TgNotice> list=this.queryForEntityList(TgNotice.class,"getNoticeLast", notice);
		if(list!=null && list.size()>0){
			return list.get(0);
		}
		return null;
	}
	
}
